 /**********************
 * Matthew Tanner
 * tannerm.onid.orst.edu
 * CS362
 * Assignment #3 unittest2.c
 * Tests the drawCard function in dominion.c
 ***********************/

#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <math.h>
#include "rngs.h"
#include "tests.h"

void unittest2(){

	//set minimum required variables
	struct gameState g;
	int players = 2;
	int k[10] = {adventurer, council_room, sea_hag, gardens, mine, remodel, smithy, village, baron, great_hall};
	int seed = 100;
	int res, numPlayerCards, player;

	//initialize game
	res = initializeGame(players, k, seed, &g);


	printf("Testing drawCard\n");

	// Confirm both players starting with 5 cards.
	numPlayerCards = numHandCards(&g);
		assert(numPlayerCards == 5);
		printf("Confirmed player %d correctly has %d cards upon initialization\n", whoseTurn(&g) +1 ,numPlayerCards);

	// end turn and test other player
	endTurn(&g);

	numPlayerCards = numHandCards(&g);
	assert(numPlayerCards == 5);
	printf("Confirmed player %d correctly has %d cards upon initialization\n", whoseTurn(&g) +1 ,numPlayerCards);

	// Player draw card
	player = whoseTurn(&g);
	printf("Player %d draws card\n", player+1);
	res = drawCard(player, &g);
	numPlayerCards = numHandCards(&g);
	assert(numPlayerCards == 6);
	printf("Confirmed player %d correctly has %d cards after drawing 1 card\n", player+1, numPlayerCards);

	// end turn and test other player
	endTurn(&g);

	player = whoseTurn(&g);
	printf("Player %d draws card\n", player+1);
	res = drawCard(player, &g);
	numPlayerCards = numHandCards(&g);
	assert(numPlayerCards == 6);
	printf("Confirmed player %d correctly has %d cards after drawing 1 card\n", player+1, numPlayerCards);
}